Image information can be formed by e.g. cameras having image sensors, which comprise a plurality of photosensitive elements. These photosensitive elements can be arranged into a matrix form comprising k rows and I columns. The parameters k and I are greater or equal to 1. Further, the parameters k and I need not be equal. For example, a image sensor can have photosensitive elements arranged into 230 rows and 340 columns, thus the image sensor can produce an image of 340×230 pixels. The term pixel is a contraction of the term picture element. Other known image sizes are, for example, 400×336 pixels, 752×582 pixels, and 1920×1024 pixels. These are only non-limiting examples and other image sizes have been used besides those mentioned above.
In a color image there are a certain number of different color components. Typically three color components are used, which in a widely used color format are red, green and blue (RGB). The color components need not be distributed over the image area in such a way that there is an equal number of each of these color components or that every third color component in a line is the same. For example, in the so called Bayer matrix image the data of a color image is represented in such a way that between two identical color components on the same line, there is another color component (for example, GRGRGR or BGBGBG, in which R means red color component, G means green color component, and B means blue color component).
Image sensors comprise semiconductor cells, such as CCD (Charge Coupled Device) or CMOS (Complementary Metal-Oxide Semiconductor) cells comprising a photosensitive element. The operation of the sensor in the cell is based on, for example, the principle that when radiation impinges on the photosensitive elements, the photosensitive elements are electrically charged. The amount of the charge is dependent on inter alia the intensity of the radiation and the radiation time. For color detection, the photosensitive elements of the cells are covered by a filter which passes through radiation in a certain wavelength range. For example, in the above mentioned RGB color system the photosensitive elements are covered by a red filter, a green filter or a blue filter, forming a color filter array. The term red filter means a filter which passes through mainly radiation at the wavelength area which a human eye recognizes as a red color. Respectively, the term green filter means a filter which passes through mainly radiation at the wavelength area which a human eye recognizes as a green color, and term blue filter means a filter which passes through mainly radiation at the wavelength area which a human eye recognizes as a blue color. The number of each color in the color filter array is not necessarily the same but, for example, half of the filters are green, a quarter of the filters are red and another quarter of the filters are blue.
When the signal formed by an image sensor is digitized, a number (N) of bits (for example, 8, 10 or 12 bits) per each pixel are formed the value of the bits depending on the intensity (e.g. a voltage level) of the signal. Sometimes there may be a need to convert the pixel data of an image to a smaller size, for example to reduce the amount of memory needed to store an image or a part of an image or to reduce the bandwidth needed to transmit the image data through an interface or through a transmission channel.
Furthermore, the compression of the image may be necessary to enable one to produce and display images with devices having less computing capacity and/or memory than larger scale computing devices. For example, many mobile communication devices are such devices in which processing capacity for producing and displaying images is limited. In mobile communication devices, the use of images is largely similar to the use in computers. Images are stored in the device or a memory device attached with the device and the images are transmitted to another device across a communication network in use. The transmission of images in the communication network, such as a mobile telephone network, is problematic because of the large quantity of information to be transferred. Also interfaces, such as a memory interface or an interface between a camera and a processor, may require that the image data need to be compressed for transmitting through the interface.
It is also possible that the captured N bits image has to be stored to an M bits temporal memory before processing. Usually 1 byte of memory consists of 8 bits and so storing e.g. 10 bits per pixel is not very popular, but 8 bits per pixel is used. Sometimes, it is also required that there should be many synchronization points in the saved bitstream. E.g. each line of the image can be decoded separately, if the decoded line does not require any information outside the line.
Differential pulse code modulation (DPCM) is a known method by which a pixel is encoded/transmitted on the basis of a pixel preceding the pixel to be encoded. The method is used for the conversion of an analog signal to a digital signal, wherein the difference between a sampled value of the analog signal and its predicted value is quantized and encoded in digital format. Code words formed by the DPCM method represent differences between successive values.
A differential pulse code modulation (DPCM) codec can be used to reduce redundancy between image pixels. By differentiating the pulse code modulated (PCM) code words, a DPCM code word sequence of variable length is obtained, which normally compresses the given data to a format suitable for the transmission. Because the code words are normally of variable length, the resulting code word is not always necessarily shorter than or equal to a limit value (M) (a predetermined number of bits), because the longest code word is longer than the original number (N) of bits. To make the code word shorter than the limit value (M), the DPCM code words are quantized, after which the compression method becomes lossy i.e. some information may be lost due to the quantization.
When a lossy codec is used the aim is that the decoded result image is as near the encoded original image as possible. There are at least three good properties of image codecs; simple to implement, do not require big buffers and if possible they use fixed length codes. The fixed length codes are easier to decode and usually the output is suitable for the transmission. Also buffering can be smaller, or it is not needed at all, when fixed length codes are used. Sometimes it can also be required that some symbol (e.g. 0) should not be presented in the bitstream so that e.g. wrong start code is avoided.
Look-up-tables (LUT) can also be used in encoding pixel values. Look-up-tables consist of table of replacement values which will replace the original value (value to be encoded). The original value is used as a pointer to the table. The length of the replacement values can be the same but it is possible to use more replacement values in such areas where the most of the original pixel values are than in areas where there are only a few original values. Another alternative is that dark values are quantized less wherein more replacement values are available for the dark values and bright values are quantized more (e.g. an A-law LUT table).
It is also possible that the original values are quantized differently by using an equation instead of LUT. For example, piece-wise different quantization values from 8 to 7 bits could be based on the following choice of quantization values:                for original values between 0 to 63 the quantizer Q=1 which means that the original value would be retained;        for original values between 64 and 143 the quantizer Q=2 meaning that the replacement values are from 64 to 103;        for original values from 144 to 223 the quantizer Q=4 and the replacement values are from 104 to 123; and        for original values from 224 to 255 the quantizer Q=8 and the replacement values are from 124 to 127.        
If there is need to rotate an image (e.g. 90 degrees) the rotation may require a lot of memory. Sometimes it is better to process an image block by block instead of line by line. If an image is to be processed as vertical slices, the image has to be decoded as many times as there are slices if storing of decoded image frame should be avoided.